package org.wkg.lesson09;

import java.util.concurrent.*;

public class Demo_908 {

    public static void main(String[] args) {
        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, 10, 10, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(5), new ThreadPoolExecutor.CallerRunsPolicy());

        for (int i = 0; i < 50; i++) {
            int task = i + 1;
            threadPool.submit(() -> {
                System.out.println("执行任务：" + task + " " + Thread.currentThread().getName());
            });
        }
    }
}
